package sg.edu.nus.iss.team2s.jass.control;

import sg.edu.nus.iss.team2s.jass.dto.User;
import sg.edu.nus.iss.team2s.jass.dao.DAOException;
import sg.edu.nus.iss.team2s.jass.dao.DAOInterface;
import sg.edu.nus.iss.team2s.jass.dao.DAOFactory;

public class LoginController {
	public static User validateLogin(String userName, String passWord){
		DAOInterface userInterface = (DAOInterface)DAOFactory.getDAO(User.class.getName());
		User user = null;
		try {
			user = (User)userInterface.get(userName + "|" + passWord);
			MainController.setUser(user);
		} catch (DAOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return user;
	}
}
